package com.project.internship.controller.evaluate;

import com.project.internship.entity.BaseEvaluate;
import com.project.internship.entity.resp.RespBean;
import com.project.internship.service.BaseEvaluateService;
import com.project.internship.vo.BaseEvaluateVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 教师端基地评价
 */
@RestController
@RequestMapping("/evaluate/base")
public class EvaBaseController {

    @Autowired
    BaseEvaluateService beService;

    /**
     * 获取今年分配的基地信息
     * @return
     */
    @GetMapping("/")
    public List<BaseEvaluateVO> getAllotBaseEva(){
        return beService.getAllotBaseEva();
    }

    /**
     * 添加今年基地评价
     * @param baseEvaluate
     * @return
     */
    @PostMapping("/")
    public RespBean addBaseEva(@RequestBody BaseEvaluate baseEvaluate){
        if(beService.addBaseEva(baseEvaluate) == 1){
            return RespBean.ok("添加成功！");
        }
        return RespBean.error("添加失败！");
    }

}
